// components/authorization/index.js
Component({
  data: {
    isLogin: false
  },

  lifetimes: {
    attached() {
      const app = getApp()
      let isLogin = Boolean(app.token)
      this.setData({ isLogin })

      if (!isLogin) {
        const pageStack = getCurrentPages()
        const currentPage = pageStack[pageStack.length - 1]
        const redirectURL = currentPage.route
        wx.redirectTo({ url: `/pages/login/index?redirectURL=/${redirectURL}` })
      }
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {

  }
})
